package mediator.improve;

/**
 * 具体同事类
 */
public class ChatUser extends User {
    public ChatUser(Mediator mediator, String name) {
        super(name, mediator);
        mediator.register(this);
    }

    @Override
    public void send(String message) {
        System.out.println(name + " sends: " + message);
        mediator.sendMessage(message, this);
    }

    @Override
    public void receive(String message) {
        System.out.println(name + " receives: " + message);
    }
}
